﻿using System;
using System.Collections.Generic;
using System.Text;
using PPAP.DAO;
using PPAP.Model;
using System.Data;

namespace PPAP.BO
{
    public class PPInfoBO
    {
        public PPInfoBO() { }
        PPINFODAO dao = new PPINFODAO();

        #region  成员方法

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(PPINFO model)
        {
            return dao.Add(model);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public int Update(PPINFO model)
        {
            return dao.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public int Delete(int id)
        {
            return dao.Delete(id);
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public PPINFO GetModel(int id)
        {
            return dao.GetModel(id);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dao.GetList(strWhere);
        }

        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            OracleParameter[] parameters = {
                    new OracleParameter(":tblName", OracleType.VarChar, 255),
                    new OracleParameter(":fldName", OracleType.VarChar, 255),
                    new OracleParameter(":PageSize", OracleType.Number),
                    new OracleParameter(":PageIndex", OracleType.Number),
                    new OracleParameter(":IsReCount", OracleType.Clob),
                    new OracleParameter(":OrderType", OracleType.Clob),
                    new OracleParameter(":strWhere", OracleType.VarChar,1000),
                    };
            parameters[0].Value = "PPINFO";
            parameters[1].Value = "ID";
            parameters[2].Value = PageSize;
            parameters[3].Value = PageIndex;
            parameters[4].Value = 0;
            parameters[5].Value = 0;
            parameters[6].Value = strWhere;	
            return DbHelperOra.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        }*/

        public string GetSupplierByPartID(int id)
        {
            return dao.GetSupplierByPartID(id);
        }

        ///// <summary>
        ///// 获得数据列表
        ///// </summary>
        //public DataSet GetList(string Orderstr, string strWhere, int PageSize, int CurrentPage)
        //{
        //    SqlParameter[] Params = { new SqlParameter("@select", "*"), new SqlParameter("@order", Orderstr), new SqlParameter("@where", "" + strWhere), new SqlParameter("@table", " GetPPAPSupplier"), new SqlParameter("@CurrentPage", CurrentPage), new SqlParameter("@PageSize", PageSize) };
        //    return AccessHelper.GetSearchResult("SearchResult", Params, CommandType.StoredProcedure);
        //}

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dao.GetList(Top, strWhere, filedOrder);
        }

        /// <summary>
        /// 分配任务
        /// </summary>
        /// <param name="ids">产品ID</param>
        /// <param name="tid">测试人员ID</param>
        /// <returns></returns>
        public int FP(string ids, string tid)
        {
            return dao.FP(ids, tid);
        }

        /// <summary>
        /// 待初审
        /// </summary>
        /// <returns></returns>
        public DataSet Getpp()
        {
            return dao.Getpp();
        }

        /// <summary>
        /// 待测试
        /// </summary>
        /// <returns></returns>
        public DataSet GetppForTest(string UserNo)
        {
            return dao.GetppForTest(UserNo);
        }

        /// <summary>
        /// 测试查询
        /// </summary>
        /// <returns></returns>
        public DataSet GetppForTestAll(string UserNo)
        {
            return dao.GetppForTestAll(UserNo);
        }

        /// <summary>
        /// 待测试
        /// </summary>
        /// <returns></returns>
        public DataSet GetppForTestByID(string id)
        {
            return dao.GetppForTestByID(id);
        }

        /// <summary>
        /// 获取最终决定数据
        /// </summary>
        /// <returns></returns>
        public DataSet GetppForFinal()
        {
            return dao.GetppForFinal();
        }

        /// <summary>
        /// 获取待初审详情
        /// </summary>
        /// <returns></returns>
        public DataTable GetppByID(string ID)
        {
            return dao.GetppByID(ID);
        }

        /// <summary>
        /// 修改状态
        /// </summary>
        /// <param name="id"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public int UpdateStatus(int id, int status, string sqlwhere)
        {
            return dao.UpdateStatus(id, status, sqlwhere);
        }

        /// <summary>
        /// QM上传附件
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="SampleReportFJID"></param>
        /// <returns></returns>
        public int UpSampleReportFJID(string ID, string SampleReportFJID)
        {
            return dao.UpSampleReportFJID(ID, SampleReportFJID);
        }

        /// <summary>
        /// 获取所有附件信息
        /// </summary>
        /// <returns></returns>
        public DataSet GetAllFile()
        {
            return dao.GetAllFile();
        }

        /// <summary>
        /// 获取供应商组件发布信息
        /// </summary>
        /// <param name="userno"></param>
        /// <returns></returns>
        public DataSet GetQYList(string userno, int pageindex, int pagesize)
        {
            return dao.GetQYList(userno,pageindex,pagesize);
        }

        /// <summary>
        /// 获取供应商组件发布信息条数
        /// </summary>
        /// <param name="userno"></param>
        /// <returns></returns>
        public int GetQYList(string userno)
        {
            return dao.GetQYList(userno);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public PPINFO GetModelByPPID(int ID)
        {
            return dao.GetModelByPPID(ID);
        }

        #endregion  成员方法
    }
}
